<%@page import="cn.sendto.model.ParkInfoModel"%>
<%@page import="cn.sendto.service.ParkInfoService"%>
<%@page import="java.util.ArrayList"%>
<%@page import="cn.sendto.model.CarInfoModel"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.service.CarInfoService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="../err.jsp"%>
<jsp:include page="../lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改车辆信息</title>
<style>
.txt20 {
	font-size: 20px;
}

.td {
	font-size: 18px;
	height: 50px;
	text-align: right;
}
.star{
	font-size:12px;
	color:red;
}
</style>
</head>
<body>
	<div class="txt20">当前位置-->修改设备信息</div>
	<%
		request.setCharacterEncoding("UTF-8");
		String SbID = request.getParameter("id");
		String Sbname = "null";
		int Sbtype = 0;
		String Chargeman = "null";
		String Status = "null";
		String Department= "null";
		CarInfoService cis = new CarInfoService();
		List<CarInfoModel> list = cis.car(SbID);
		if (list.size() > 0) {
			Sbname = list.get(0).getSbname();
			Sbtype = list.get(0).getSbtype();
			Chargeman = list.get(0).getChargeman();
			Status= list.get(0).getStatus();
			Department= list.get(0).getDepartment();
		}

		//判断错误信息
		ArrayList<Integer> errlist = new ArrayList<Integer>();
		if (request.getAttribute("errinfo") != null) {
			errlist = (ArrayList<Integer>) request.getAttribute("errinfo");
		}
	%>
	<div>
		<form action="domodcar.jsp" method="post">
			<table width="95%" cellspacing="1" cellpadding="0" align="center"
				style="background-color: azure">
			<input type="hidden" name="SbID"
						value="<%=SbID%>">
				
				<tr>
					<td class="td">设备名称：</td>
					<td><input type="text" name="Sbname"
						value="<%=Sbname%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 2) {
									out.println("<span class=\"star\">*请输入设备名称。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">设备型号：</td>
					<td><input type="text" name="Sbtype" value="<%=Sbtype%>">
			<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 3) {
									out.println("<span class=\"star\">*请输入设备型号。</span>");
									break;
								}
							}
						%>
			</td>
				</tr>
				<tr>
					<td class="td">负责人：</td>
					<td>
					<input type="text" name="Chargeman" 
					  value="<%=Chargeman%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 4) {
									out.println("<span class=\"star\">*请输入负责人。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">说明状态：</td>
					<td><input type="text" name="Status"
						value="<%=Status%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 4) {
									out.println("<span class=\"star\">*请输入说明状态。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">所属教室：</td>
					<td>
					<select name="Department">
					 <%
					ParkInfoService pis = new ParkInfoService();
					List<ParkInfoModel> list1 = pis.allPark();
					if(list1.size() > 0){
						for (int i = 0; i < list1.size(); i++) {
							List<CarInfoModel>  lt  = cis.park(list1.get(i).getClassId());
							if(lt == null ||lt.size() <= 0 ){
					%>
					<option value="<%=list1.get(i).getClassName()%>"><%=list1.get(i).getClassName()%></option>
					<%
					}
					}}
					%>  
						</select>
						</td>
				</tr>
				<tr>
					<td></td>
					<td><input type="submit" value="提交"
						style="width: 100px; height: 25px"
						onclick="return confirm('是否确认修改')"></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>